package MathCore;

import MathCore.Expression;
import MathCore.Renders.*;
import javax.microedition.lcdui.Font;

public class Render extends Object
{
	public static Block activeBlock;
	private Expression source;
	private Stripe stripe;
	static private Font mainfont = null;
	static public int spacing = 1;
	static public Lexeme link = null;
	static public int linkColor = 0xff0000;
	static public int textColor = 0xffffff;
	static public int oneBraceColor = 0x9be49b;
	static public int twoBracesColor = 0xcc9999;
	static public int variableColor = 0x009900;
	static public Stripe activeStripe;
	static public boolean useCursor = true;

	public Render(Expression source)
	{
		this.source = source;
		upd();
	}

	public void upd()
	{
		stripe = new Stripe();
		for(Lexeme lex = source.first(); lex != null; lex = lex.next)
		{
			stripe.add(new Atom(lex));
		}
		stripe.parse();
	}

	public Block stripe()
	{
		return stripe;
	}

	static public Font getFont()
	{
		if(mainfont == null) mainfont = Font.getDefaultFont();
		return mainfont;
	}

	static public void setFont(Font font)
	{
		mainfont = font;
	}
}
